<?php
namespace app\index\model;

use think\Model;

class UserModel extends Model
{
    // 确定链接表名
    protected $table = 'wb_buser';

    /**
     * 根据搜索条件获取用户列表信息
     * @param $where
     * @param $offset
     * @param $limit
     */
    public function getUsersByWhere($where, $offset, $limit)
    {
        return $this->field($this->table . '.username,password')
            ->join('wb_buser', $this->table . '.buser_id = ' . 'wb_buser.id')
            ->where($where)->limit($offset, $limit)->order('id desc')->select();
    }



    /**
     * 根据用户名获取用户信息
     * @param $name
     */
    public function findUserByName($name)
    {
        return $this->where('username', $name)->find();
    }

    public function findUserByNam($tel)
    {
        return $this->where('tel', $tel)->find();
    }
}
